﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Cryomancer.StarChart">
	
	<SolidColorBrush x:Key="ForegroundCtrlSpace" Color="#FF595959" />
	<SolidColorBrush x:Key="BackgroundCtrlSpace" Color="#FF333333" />
	<SolidColorBrush x:Key="BackgroundSpace"     Color="#FF444444" />
	<SolidColorBrush x:Key="ScrollbarForeground" Color="#FF808080" />
	<SolidColorBrush x:Key="ScrollbarBackground" Color="#FF3d3d3d" />
	<SolidColorBrush x:Key="MenuBackground"      Color="#FF3a3a3a" />
    <SolidColorBrush x:Key="TextColor"           Color="#FFc9c9c9" />

	<Storyboard x:Key="FlipChartBackStoryboard" Duration="0:0:1" >
		<Rotation3DAnimation Storyboard.TargetName="Part_geometryMainPage" Storyboard.TargetProperty="(Model3D.Transform).(Transform3DGroup.Children)[0].(RotateTransform3D.Rotation)">
			<Rotation3DAnimation.To>
				<AxisAngleRotation3D Angle="180" Axis="0,1,0"/>
			</Rotation3DAnimation.To>
		</Rotation3DAnimation>
	</Storyboard>
	
	<Storyboard x:Key="FlipChartFrontStoryboard" Duration="0:0:1" >
		<Rotation3DAnimation Storyboard.TargetName="Part_geometryMainPage" Storyboard.TargetProperty="(Model3D.Transform).(Transform3DGroup.Children)[0].(RotateTransform3D.Rotation)">
			<Rotation3DAnimation.To>
				<AxisAngleRotation3D Angle="0" Axis="0,1,0"/>
			</Rotation3DAnimation.To>
		</Rotation3DAnimation>
	</Storyboard>
	
	<Style x:Key="FlipButtonStyle" TargetType="{x:Type Button}">
		<Setter Property="Opacity" Value="0.25" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate>
					<Grid>
						<Image Width="50" Height="50">
							<Image.Source>
								<BitmapImage DecodePixelWidth="50" DecodePixelHeight="50" UriSource="Graphics/FlipGraphic.png" />
							</Image.Source>
						</Image>
					</Grid>
					<ControlTemplate.Resources>
						<Storyboard x:Key="FlipButtonMouseEnterStoryboard" x:Name="FlipEnter">
							<DoubleAnimation To="1.0" Duration="0:0:0.125" Storyboard.TargetProperty="(Button.Opacity)"/>
						</Storyboard>
						<Storyboard x:Key="FlipButtonMouseExitStoryboard" x:Name="FlipExit">
							<DoubleAnimation To="0.25" Duration="0:0:0.125" Storyboard.TargetProperty="(Button.Opacity)"/>
						</Storyboard>
					</ControlTemplate.Resources>
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="True">
							<Trigger.ExitActions>
								<BeginStoryboard Storyboard="{StaticResource FlipButtonMouseExitStoryboard}" x:Name="FlipButtonMouseExitStoryboard_BeginStoryboard"/>
							</Trigger.ExitActions>
							<Trigger.EnterActions>
								<BeginStoryboard Storyboard="{StaticResource FlipButtonMouseEnterStoryboard}" x:Name="FlipButtonMouseEnterStoryboard_BeginStoryboard"/>
							</Trigger.EnterActions>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style TargetType="{x:Type local:VSPChartView}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type local:VSPChartView}">
					<Grid>
						<StackPanel Panel.ZIndex="1" Width="50" Height="50" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="25,25" >
							<Button Name="Part_buttonFlip" Width="50" Height="50" Style="{StaticResource FlipButtonStyle}" />
						</StackPanel>
						<DockPanel LastChildFill="True">
                            <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Background="{StaticResource BackgroundCtrlSpace}" >
								<Viewport3D x:Name="Part_viewportMain">
									<Viewport3D.Camera>
										<PerspectiveCamera x:Name="Part_cameraMain"
										Position="0,0,20" 
										LookDirection="0,0,-1" 
										UpDirection="0,1,0" 
										FieldOfView="35" />
									</Viewport3D.Camera>

									<Viewport3D.Children>
										<ModelVisual3D>
											<ModelVisual3D.Content>
												<DirectionalLight Color="White" Direction="0,0,-1" />
											</ModelVisual3D.Content>
										</ModelVisual3D>

										<ModelVisual3D x:Name="Part_modelMainPage">
											<ModelVisual3D.Content>
												<GeometryModel3D x:Name="Part_geometryMainPage">
													<GeometryModel3D.Geometry>
														<MeshGeometry3D 
														  Positions="-4,-5,0 4,-5,0 -4,5,0 4,5,0"
														  Normals="0,0,1 0,0,1 0,0,1 0,0,1"
														  TextureCoordinates="0,1 1,1 0,0 1,0"
														  TriangleIndices="0,1,2  1,3,2" />
													</GeometryModel3D.Geometry>
													<GeometryModel3D.Transform>
														<Transform3DGroup>
															<RotateTransform3D>
																<RotateTransform3D.Rotation>
																	<AxisAngleRotation3D Angle="0" Axis="0,1,0"/>
																</RotateTransform3D.Rotation>
															</RotateTransform3D>
														</Transform3DGroup>
													</GeometryModel3D.Transform>
													<GeometryModel3D.Material>
														<DiffuseMaterial >
															<DiffuseMaterial.Brush>
																<ImageBrush x:Name="Part_imageBrushFront" ImageSource="W UMa.png" />
															</DiffuseMaterial.Brush>
														</DiffuseMaterial>
													</GeometryModel3D.Material>
													<GeometryModel3D.BackMaterial>
														<DiffuseMaterial>
															<DiffuseMaterial.Brush>
																<ImageBrush x:Name="Part_imageBrushBack" ImageSource="W UMa.png"/>
															</DiffuseMaterial.Brush>
														</DiffuseMaterial>
													</GeometryModel3D.BackMaterial>
												</GeometryModel3D>
											</ModelVisual3D.Content>
										</ModelVisual3D>
									</Viewport3D.Children>
								</Viewport3D>
								<ScrollViewer.BitmapEffect>
									<BlurBitmapEffect x:Name="Part_blurEffectEnabledState" Radius="0"/>
								</ScrollViewer.BitmapEffect>
							</ScrollViewer>
						</DockPanel>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>
